﻿using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using test.demo.Model.WM仓储管理;
using wangyaxin.Zhangduo;
using wangyaxin.Zhangduo.WMItemRecpt;

namespace wangyaxin.Web.ZdController
{
    public class WMItemRepoctController : Controller
    {
        public readonly WMItemRecptService _appService;
        public WMItemRepoctController(WMItemRecptService appService)
        {
            _appService = appService;
        }
        public IActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        public IActionResult ShowWMItemRepcot()
        {
            return View();
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <returns></returns>
        public IActionResult AddWMItemRepcot()
        {
            return View();
        }

        /// <summary>
        /// 显示采购入库
        /// </summary>
        /// <param name="RecptCode">入库单编号</param>
        /// <param name="RecptName">入库单名称</param>
        /// <param name="VendorName">供应商名称</param>
        /// <param name="PoCode">订单编号</param>
        /// <param name="RecptDate">入库日期</param>
        /// <returns>返回满足条件的入库列表</returns>
        public Task<string> GetWMitemRecpt(string? RecptCode, string? RecptName, string? VendorName, string? PoCode, string? RecptDate)
        {
            var item = _appService.GetWMitemRecpt(RecptCode, RecptName, VendorName, PoCode, RecptDate);
            return item;
        }
        /// <summary>
        /// 显示仓库
        /// </summary>
        /// <returns>返回仓库列表</returns>
         public Task<string> GetWmWarehouse()
        {
            var item=_appService.GetWmWarehouse();
            return item;
        }
        /// <summary>
        /// 显示供应商
        /// </summary>
        /// <returns>返回供应商列表</returns>
        public Task<string> GetVendor()
        {
            var item = _appService.GetVendor();
            return item;
        }
        /// <summary>
        /// 添加采购信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns>返回受影响行数</returns>
        [HttpPost]
        public Task<string> AddWMitemRecpt(WM_Item_Recpt model)
        {
            var relust = _appService.AddWMitemRecpt(model);
            return relust;
        }
    }
}
